<%@ Page Language="C#" %>
<%@ Import Namespace="BLF.WWW_WWW.Wiki" %>
<%@ Import Namespace="Model.WWW_WWW.Wiki" %>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["Page"] != null)
        {
            PageInfo page = Pages.Instance.FindPage(Request["Page"]);
            if (page == null) return;
            else
            {
                if (page.Status != PageStatus.Public)
                {
                    if (SessionFacade.LoginKey == null && Request.Cookies[Settings.LoginCookieName] != null)
                    {
                        Response.Redirect("/user/Login.htm?ReturnUrl=SessionRefresh.htm" + (Request["Page"] != null ? Tools.UrlEncode("?Page=" + Request["Page"]) : ""));
                    }
                }
                string username = Request.UserHostAddress;
                if (SessionFacade.LoginKey != null) username = SessionFacade.Username;
                Collisions.Instance.Renew(page, username);
            }
        }

    }

    public void PrintRefresh()
    {
        Response.Write(@"<meta http-equiv=""refresh"" content=""");
        Response.Write(Collisions.RefreshInterval.ToString());
        Response.Write(@""" />");
    }
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Session Renewal</title>
    <% PrintRefresh(); %>
</head>
<body>
</body>
</html>
